
version 15
capture log close
set more off
clear
clear matrix
clear mata

if c(username)=="WB485280" {
		glo rootdir		"C:\Users\wb485280\OneDrive - WBG\radicalization"
		}
if c(username)=="WB382635" {
		glo rootdir		"C:\Users\wb382635\Dropbox\Unemp & daesh"
		}
if c(username)=="WB452275" {
		glo rootdir		"C:\Users\WB452275\Dropbox\Projects\Unemp & daesh"
		}
if c(username)=="sarurchaudhary" {
		glo rootdir		"/Users/sarurchaudhary/Dropbox/Unemp & daesh"
		}
if c(username)=="kartikabhatia" {
			glo rootdir		"/Users/kartikabhatia/Dropbox/Before2019/Unemp & daesh"
			}
			
		glo	datadir     "${rootdir}/Data/Raw data"
		glo outdir		"${rootdir}/Data/Working datasets"
		glo dodir		"${rootdir}/Dofiles"
        
		cd "${outdir}"
		
		
	    log using distance_prep, replace t

* ------------------------------------------------------------------------------
* Date : July 2017 [chkd oct 2021]


* Project : Mena Economic Monitor, Fall 2016 edition (MNACE, The World Bank)


* This do file prepares the distance database for merge

* Database used : distance_hdi_data.dta


* Output : distance.dta

* ------------------------------------------------------------------------------

* Preparing the distance data for merge

use "${datadir}/distance_hdi_data.dta" , clear
rename country countryname
gen year=2010
        replace countryname = "Egypt, Arab Rep." if countryname =="Egypt"
		replace countryname = "Gambia, The" if countryname =="Gambia"
        replace countryname = "Iran, Islamic Rep." if countryname =="Iran"
		replace countryname = "Hong Kong SAR, China" if countryname =="Hong Kong"
		replace countryname = "Kyrgyz Republic" if countryname =="Kyrgystan"
		replace countryname = "Lao PDR" if countryname =="Laos"
		replace countryname = "Macedonia, FYR" if countryname =="Macedonia"
		replace countryname = "Russian Federation" if countryname =="Russia"
		replace countryname = "Tajikistan" if countryname =="Tajikestan"
		replace countryname = "Venezuela, RB" if countryname =="Venezuela"
		replace countryname = "Yemen, Rep." if countryname =="Yemen"
		replace countryname = "Syrian Arab Republic" if countryname =="Syria"
		replace countryname = "Nagorno Karabakh" if countryname =="Nagoro Kharabakh"
        drop if countryname=="Western Sahara"		  
sort countryname year		
save "${outdir}/distance.dta" , replace

log close
